﻿//-----------------------------------------------------------------------
// <copyright file="IMergeCellInternal.cs" company="LMT">
//     Copyright (c) by La Minh Thuận.
// </copyright>
// <author>thuanla1985@hotmail.com</author>
//-----------------------------------------------------------------------
namespace LMT.Forms
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    /// <summary>
    /// A specify TextBoxColumn class has a merge ability
    /// </summary>
    [ToolboxBitmap(typeof(DataGridViewTextBoxColumn))]
    public class MergeGridViewCheckBoxColumn : MergeGridViewColumn
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MergeGridViewCheckBoxColumn"/> class.
        /// </summary>
        public MergeGridViewCheckBoxColumn() : base(new MergeGridViewCheckBoxCell())
        {
        }

        /// <summary>
        /// Gets or sets the template used to create new cells.
        /// </summary>
        /// <value></value>
        /// <returns>
        /// A <see cref="T:System.Windows.Forms.DataGridViewCell"/> that all other cells in the column are modeled after. The default is null.
        /// </returns>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
        public override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }

            set
            {
                if ((value != null) && !(value is MergeGridViewCheckBoxCell))
                {
                    throw new InvalidCastException("This column can only contain MergeGridViewCheckBoxCell.");
                }

                base.CellTemplate = value;
            }
        }
    }
}
